package p270jp.pxv.android.viewholder;

import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import p134ei.AnalyticsScreenName;
import p165fo.C3114c;
import p184gi.FirebaseScreenNameVia;
import p270jp.pxv.android.R;
import p270jp.pxv.android.event.LoadProfileEvent;
import p270jp.pxv.android.legacy.model.PixivIllust;
import p270jp.pxv.android.legacy.model.PixivUser;
import p270jp.pxv.android.view.DetailProfileWorksView;
import p270jp.pxv.android.viewholder.CalcHeightViewHolder;

/* renamed from: jp.pxv.android.viewholder.DetailProfileIllustsViewHolder */
/* loaded from: classes2.dex */
public class DetailProfileIllustsViewHolder extends CalcHeightViewHolder {
    private DetailProfileWorksView detailProfileWorksView;

    /* renamed from: jp.pxv.android.viewholder.DetailProfileIllustsViewHolder$UserProfileIllustItem */
    /* loaded from: classes2.dex */
    public static class UserProfileIllustItem extends CalcHeightViewHolder.CalcHeightItem {
        private List<PixivIllust> illustList = new ArrayList();
        private FirebaseScreenNameVia itemClickAnalytics;
        private PixivUser user;

        public UserProfileIllustItem(PixivIllust pixivIllust) {
            this.user = pixivIllust.user;
            registerAnalyticsForItemClick(pixivIllust.getIllustType());
        }

        /* JADX INFO: Access modifiers changed from: private */
        public FirebaseScreenNameVia getItemClickAnalytics() {
            return this.itemClickAnalytics;
        }

        private void registerAnalyticsForItemClick(PixivIllust.Type type) {
            if (type.isIllustTypeForAnalytics()) {
                this.itemClickAnalytics = new FirebaseScreenNameVia(AnalyticsScreenName.ILLUST_DETAIL, 3);
            } else if (type.isMangaTypeForAnalytics()) {
                this.itemClickAnalytics = new FirebaseScreenNameVia(AnalyticsScreenName.MANGA_DETAIL, 3);
            }
        }

        public List<PixivIllust> getIllustList() {
            return this.illustList;
        }

        public void setIllustList(List<PixivIllust> list) {
            this.illustList = list.subList(0, Math.min(3, list.size()));
        }
    }

    public DetailProfileIllustsViewHolder(View view) {
        super(view);
        this.detailProfileWorksView = (DetailProfileWorksView) view.findViewById(R.id.detail_profile_illusts_view);
    }

    public static int getLayoutRes() {
        return R.layout.view_detail_profile_illusts;
    }

    @Override // p270jp.pxv.android.viewholder.BaseViewHolder
    public void bind(Object obj) {
        super.bind(obj);
        UserProfileIllustItem userProfileIllustItem = (UserProfileIllustItem) obj;
        if (userProfileIllustItem.getIllustList().size() > 0) {
            this.detailProfileWorksView.setUserUnitWorkClickAnalytics(userProfileIllustItem.getItemClickAnalytics());
            this.detailProfileWorksView.m4499b(userProfileIllustItem.user, userProfileIllustItem.getIllustList());
        }
        C3114c.m6284b().m6280f(new LoadProfileEvent(userProfileIllustItem.user.f19078id));
        postCalcViewHeight(userProfileIllustItem);
    }

    @Override // p270jp.pxv.android.viewholder.BaseViewHolder
    public void onCreateView(ViewGroup viewGroup) {
        super.onCreateView(viewGroup);
    }
}
